/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.kpi.transport.servlet.actions.deleting;

import ua.kpi.transport.servlet.actions.IAction;
import ua.kpi.transport.servlet.actions.lists.StationsListAction;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ua.kpi.transport.db.dao.factory.DAOFactory;
import ua.kpi.transport.db.dao.factory.DBEnum;
import ua.kpi.transport.db.dao.interfaces.IStationDAO;
import ua.kpi.transport.servlet.actions.IAction;

/**
 *
 * @author harker777
 */
public class DeleteStationAction extends StationsListAction implements IAction{
    

    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        IStationDAO sd = DAOFactory.getDAOFactory(DBEnum.MYSQL).getStationDAO();
        sd.delete(sd.find(Integer.valueOf(request.getParameter("id"))));
        StationsListAction sa = new StationsListAction();
        return sa.execute(request, response);
    }
    
}
